<?php
error_reporting(E_ALL);
date_default_timezone_set("Europe/London");
ini_set('display_errors', '1');

$topdirectory="../MSWebGUI";
include $topdirectory.'/FileList.php';

$topdirectory="../Classes";
include $topdirectory.'/FileList.php';

$xml = simplexml_load_file('../config/config.xml');
$databaseXML = $xml->Database;
$database = new Database($databaseXML->Server,$databaseXML->Database,$databaseXML->Username,$databaseXML->Password);


$sql = "SELECT * from Actions ORDER BY ActionDate DESC LIMIT ".$_GET['start'].",20";
$database->ExecuteSQL($sql);
$html = "<table>\n";
while($row=$database->getRow())
{
	$resource = new Resource($database,$row['ResourceID']);
	
	// get action name
	$sql1 = "SELECT LongName from ActionTypes where ActionTypeID = ".$row['ActionTypeID'];
//			echo $sql1."<br>\n";
	$database1 = $database->recopy();
	$database1->ExecuteSQL($sql1);
	$row1 = $database1->getRow();
//			print_r($row1);
	
	// get user
	$sql1 = "SELECT LongName from Users where UserID = ".$row['ActionUserID'];
	$database1->ExecuteSQL($sql1);
	$row2 = $database1->getRow();
//			print_r($row2);
	
	$date = new DateTime($row['ActionDate']);
	
	$html .= "<tr><td style=\"width:120px;\">".
	$date->format("D j M Y H:i")."</td><td style=\"width:80px;\">".
	$row2['LongName']."</td><td style=\"width:50px;\">".
	$row1['LongName']."</td><td style=\"width:250px;\">".
	"(".$resource->getResourceID().") ".
	$resource->getResourceTitle()."</td><td>".
	$row['ActionComment']."</td></tr>\n";
}
$html .= "</table>\n";

echo $html;



?>